package zt.song.controller;

import cn.hutool.core.map.MapUtil;
import jakarta.annotation.Resource;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import zt.song.service.SysUserService;
import zt.song.util.Result;

/**
 * @Author 宋伟宁
 * @Date 2023/11/21
 * @Version 1.0
 **/
@RestController
public class TestController {


    @Resource
    private SysUserService sysUserService;

    @Resource
    private PasswordEncoder passwordEncoder;

    @GetMapping("/pass")
    public Result chkpass(String pwd){
        String encode = this.passwordEncoder.encode("111111");
        boolean matches = this.passwordEncoder.matches(pwd, encode);
        return Result.succ(MapUtil.builder()
                .put("matcher",matches)
                .put("encode",encode)
                .build()
        );
    }

    @GetMapping("/list")
    public Object test1(){
        return this.sysUserService.list();
    }


}
